Many modern software applications, such a Java® applications, can be characterized as a system comprising multiple subsystems. These different subsystems can be interconnected yet remain separable. Conventionally, when only a particular subsystem of an application in a larger application is to be redesigned such that the remaining portions of the application are unchanged and unaware of the redesign, it is often necessary to provide an object adapter that will emulate replaced objects stemming from the redesign.
An object adapter, often referred to as an adapter design or wrapper pattern, adapts one interface for a class into one that can function with other classes. Specifically, an adapter allows classes that would otherwise comprise incompatible interfaces to function cooperatively. The adapter typically accomplishes this by wrapping its own interface around that of an existing class.
When an old object and a new one have different names or are in different software packages, each comprising a group of related classes of an application program, it is typically necessary to provide a solution based on a wrapper or delegation pattern implemented as an object adapter. With a wrapper or delegation pattern, an object outwardly expresses certain behaviour, but in reality delegates responsibility for implementing that behavior to an associated object.
This is often not an optimal solution, however, because it requires that the adapter instance contain the instance of the class that it wraps. This conventional technique requires that an adapter and the instance wrapped by the adapter be created from both the new subsystem—which ideally should not be aware of the existence of the adapter instances—and those portions of the original application that should otherwise remain unaltered and unaware of the change. With the conventional technique, moreover, there arises a performance penalty if an adapter is created for every instance of a given class where only some of the instances need be referenced from outside the redesigned subsystem.